#!/bin/bash
# 202111221730

CONF=$1
if [ -z "${CONF}" ]; then
    CONF=/etc/my.cnf # 取默认值
fi

if [ -f "${CONF}" ]; then
    socket_file=$(awk -F '=' '/\[mysqld\]/{a=1}a==1&&$1~/socket/{print $2;exit}' "${CONF}")
fi
echo "socket file ${socket_file}"

if [ -f socket_file ]; then
	rm -rf ${socket_file}
    rm -rf ${socket_file}.lock;
fi


